#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

#include "common.h"


bool Is2_n(int n)
{   
    //如果编译器遵循ANSI C标准，它就是个非零值
    printf("%s %d %s %s %s %d \n",__FILE__,__LINE__,__func__,__DATE__,__TIME__,__STDC__);
    if (n < 0)
    {
        printf("输入的值是: %d 不在范围内,应该大于0 Fail Exit\n",n);
        exit(0);
    }

    if (n == 0)
    {

        return false;
    }
    
    if ((n & (n-1)) == 0)
    {
        return true;
    }
    else
    {
        return false;
    }

}



int main(int argc,char *argv[])
{

    if (Is2_n(8))
    {
        printf("是2的N次幂\n");
    }
    else
    {
        printf("不是2的N次幂\n");
    }

    // test inline function to externtal link


    for (int i = 0;i < 100;i++)
    {

        printf("%d \n",add_in(12,23));
    }
    
    printf("ft = %d \n",ft);

    {

        int a[4] = {0,1,-4,5};

        

        for (int i = 0;i < 4;i++)
        {
            bool isActivated = a[i];
            printf("isActivated: %d \n",isActivated);
            if (isActivated)
            {
                printf("True\n");
            }
            else
            {
                printf("False\n");
            }
        }
        
    }
    return 0;
}